Skip to content

Zendesk ticket tags #17603

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

Conversation

seynadio
Copy link
Contributor

@seynadio seynadio commented Jul 14, 2025

WHY

  1. Enhanced Zendesk App (zendesk.app.mjs):
  • Added ticketTags prop definition: String array for tag management
  • Added three tag management methods:
    • setTicketTags(): Replace all existing tags (PUT request)
    • addTicketTags(): Append to existing tags (POST request)
    • removeTicketTags(): Remove specific tags (DELETE request)
  1. Enhanced Update Ticket Action (update-ticket/update-ticket.mjs):
  • Added ticketTags prop: Array of tags to manage
  • Added tagAction prop: Choose between set/add/remove operations
  • Updated logic: Performs tag operations after ticket update
  • Enhanced response: Includes both ticket and tag operation results
  • Improved summary: Shows tag operation details
  1. New Dedicated Tag Actions:
  • set-ticket-tags: Dedicated action to replace all tags on a ticket
  • add-ticket-tags: Dedicated action to append tags to existing ones
  • remove-ticket-tags: Dedicated action to remove specific tags

Summary by CodeRabbit

  • New Features

    • Added the ability to add internal notes when updating Freshdesk tickets.
    • Introduced new Zendesk actions to add, remove, or set tags on tickets.
    • Enhanced Zendesk ticket update to support tag management (set, add, or remove tags) during ticket updates.
  • Improvements

    • Zendesk integration now supports comprehensive tag management, allowing users to efficiently organize and update ticket tags directly.

seynadio added 2 commits July 14, 2025 10:42
- Add ticketTags prop definition to Zendesk app
- Add tag management methods: setTicketTags, addTicketTags, removeTicketTags
- Enhance update-ticket action with tag support:
  * Add ticketTags and tagAction props
  * Support set/add/remove tag operations
  * Update summary and response format
- Add dedicated tag management actions:
  * set-ticket-tags: Replace all existing tags
  * add-ticket-tags: Append to existing tags
  * remove-ticket-tags: Remove specific tags
- Follow Zendesk Tags API specification
- Support custom subdomain for Enterprise accounts
Copy link

vercel bot commented Jul 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Jul 14, 2025 11:23am

Copy link
Contributor

coderabbitai bot commented Jul 14, 2025

Walkthrough

Zendesk integration is expanded with new actions for managing ticket tags: adding, removing, and setting tags, supported by new methods in the Zendesk app module. The update-ticket action now supports optional tag operations. Freshdesk's update-ticket action is enhanced to optionally add internal notes to tickets. All changes introduce new properties and methods without altering existing control flow.

Changes

File(s) Change Summary
components/freshdesk/actions/update-ticket/update-ticket.mjs Added optional internalNote and noteBody props; logic to add internal note before ticket update.
components/zendesk/actions/add-ticket-tags/add-ticket-tags.mjs New action: Adds tags to a Zendesk ticket.
components/zendesk/actions/remove-ticket-tags/remove-ticket-tags.mjs New action: Removes tags from a Zendesk ticket.
components/zendesk/actions/set-ticket-tags/set-ticket-tags.mjs New action: Sets (replaces) all tags on a Zendesk ticket.
components/zendesk/actions/update-ticket/update-ticket.mjs Enhanced to support tag operations (set, add, remove) via new props and logic.
components/zendesk/zendesk.app.mjs Added ticketTags prop and three new methods: setTicketTags, addTicketTags, removeTicketTags.

Sequence Diagram(s)

Zendesk Ticket Tag Management (Generalized Flow)

sequenceDiagram
    participant User
    participant ZendeskAction
    participant ZendeskApp
    participant ZendeskAPI

    User->>ZendeskAction: Trigger action (add/set/remove tags)
    ZendeskAction->>ZendeskApp: Call tag method (addTicketTags/setTicketTags/removeTicketTags)
    ZendeskApp->>ZendeskAPI: Send HTTP request to /tickets/{ticketId}/tags.json
    ZendeskAPI-->>ZendeskApp: Return API response
    ZendeskApp-->>ZendeskAction: Return result
    ZendeskAction-->>User: Export summary and response
Loading

Freshdesk Update Ticket with Optional Internal Note

sequenceDiagram
    participant User
    participant UpdateTicketAction
    participant FreshdeskAPI

    User->>UpdateTicketAction: Trigger update-ticket with internalNote/noteBody
    alt internalNote is true and noteBody provided
        UpdateTicketAction->>FreshdeskAPI: POST /tickets/{ticketId}/notes (private)
        FreshdeskAPI-->>UpdateTicketAction: Return note response
        UpdateTicketAction-->>User: Export note summary and response
    else
        UpdateTicketAction->>FreshdeskAPI: PUT /tickets/{ticketId}
        FreshdeskAPI-->>UpdateTicketAction: Return update response
        UpdateTicketAction-->>User: Export update summary and response
    end
Loading

Poem

A hop to Freshdesk, a skip to Zendesk land,
Now tickets get notes, and tags by command!
Add, set, or remove—so easy and neat,
With paws on the keyboard, support is a treat.
🐇✨
Bugs beware, these changes are sweet!

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

components/freshdesk/actions/update-ticket/update-ticket.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:801:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:725:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:708:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:309:38)
at #link (node:internal/modules/esm/module_job:202:49)

components/zendesk/actions/add-ticket-tags/add-ticket-tags.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:801:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:725:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:708:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:309:38)
at #link (node:internal/modules/esm/module_job:202:49)

components/zendesk/actions/set-ticket-tags/set-ticket-tags.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:801:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:725:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:708:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:309:38)
at #link (node:internal/modules/esm/module_job:202:49)

  • 3 others
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

vercel bot commented Jul 14, 2025

@seynadio is attempting to deploy a commit to the Pipedreamers Team on Vercel.

A member of the Team first needs to authorize it.

@adolfo-pd adolfo-pd added the User submitted Submitted by a user label Jul 14, 2025
@pipedream-component-development
Copy link
Collaborator

Thank you so much for submitting this! We've added it to our backlog to review, and our team has been notified.

@pipedream-component-development
Copy link
Collaborator

Thanks for submitting this PR! When we review PRs, we follow the Pipedream component guidelines. If you're not familiar, here's a quick checklist:

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
components/zendesk/actions/update-ticket/update-ticket.mjs (2)

134-142: Remove redundant case clause.

The explicit case "set": is redundant since the default: clause performs the same action.

Apply this diff to remove the useless case:

-      case "set":
-      default:
-        tagResponse = await this.app.setTicketTags({
-          step,
-          ticketId,
-          tags: ticketTags,
-          customSubdomain,
-        });
-        break;
+      default:
+        tagResponse = await this.app.setTicketTags({
+          step,
+          ticketId,
+          tags: ticketTags,
+          customSubdomain,
+        });
+        break;

149-154: Consider consistent return value structure.

When tags are handled, the action returns { ticket: response, tags: tagResponse }, but when no tags are provided, it returns response directly. This inconsistency could complicate usage for consumers who need to handle both cases.

Consider always returning a consistent structure:

-      return {
-        ticket: response,
-        tags: tagResponse,
-      };
+      return {
+        ticket: response,
+        tags: tagResponse,
+      };
    }

-    step.export("$summary", `Successfully updated ticket with ID ${response.ticket.id}`);
-    return response;
+    step.export("$summary", `Successfully updated ticket with ID ${response.ticket.id}`);
+    return {
+      ticket: response,
+      tags: null,
+    };
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e21d334 and 86240da.

📒 Files selected for processing (6)
  • components/freshdesk/actions/update-ticket/update-ticket.mjs (3 hunks)
  • components/zendesk/actions/add-ticket-tags/add-ticket-tags.mjs (1 hunks)
  • components/zendesk/actions/remove-ticket-tags/remove-ticket-tags.mjs (1 hunks)
  • components/zendesk/actions/set-ticket-tags/set-ticket-tags.mjs (1 hunks)
  • components/zendesk/actions/update-ticket/update-ticket.mjs (4 hunks)
  • components/zendesk/zendesk.app.mjs (2 hunks)
🧰 Additional context used
🧠 Learnings (2)
components/zendesk/actions/set-ticket-tags/set-ticket-tags.mjs (1)
Learnt from: jcortes
PR: PipedreamHQ/pipedream#14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In `components/gainsight_px/actions/create-account/create-account.mjs`, the action name should be "Create Account" instead of "Create Memory".
components/zendesk/actions/update-ticket/update-ticket.mjs (2)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-07-04T18:11:59.822Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-10-08T15:33:38.240Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
🪛 Biome (1.9.4)
components/zendesk/actions/update-ticket/update-ticket.mjs

[error] 134-134: Useless case clause.

because the default clause is present:

Unsafe fix: Remove the useless case.

(lint/complexity/noUselessSwitchCase)

🔇 Additional comments (11)
components/freshdesk/actions/update-ticket/update-ticket.mjs (1)

111-114: Fix destructuring to exclude internal note properties from ticket update data.

The current destructuring includes internalNote and noteBody in the spread operator, which means these properties will be included in the data object passed to the ticket update API. These are not valid ticket fields and should be excluded.

 const {
   freshdesk,
   ticketId,
   internalNote,
   noteBody,
-  ...fields
+  ...ticketFields
 } = this;

-const data = removeNullEntries(fields);
+// Exclude internal note properties from ticket update data
+const { internalNote: _, noteBody: __, ...fields } = ticketFields;
+const data = removeNullEntries(fields);

Likely an incorrect or invalid review comment.

components/zendesk/zendesk.app.mjs (2)

177-182: LGTM: Well-defined ticketTags property.

The property definition is clear and follows existing patterns in the codebase.


309-371: LGTM: Excellent implementation of tag management methods.

The three new methods are well-implemented with:

  • Appropriate HTTP methods (PUT for set, POST for add, DELETE for remove)
  • Consistent method signatures and parameter handling
  • Comprehensive JSDoc documentation
  • Proper integration with existing makeRequest method
components/zendesk/actions/add-ticket-tags/add-ticket-tags.mjs (1)

1-48: LGTM: Clean and consistent implementation.

The action follows established patterns with:

  • Proper use of propDefinitions from the app
  • Clear and descriptive metadata
  • Appropriate method call to the app's addTicketTags method
  • Informative summary message
components/zendesk/actions/remove-ticket-tags/remove-ticket-tags.mjs (1)

1-48: LGTM: Consistent and well-structured implementation.

The action follows established patterns with:

  • Proper use of propDefinitions from the app
  • Clear documentation referencing Zendesk API docs
  • Appropriate method call to the app's removeTicketTags method
  • Informative summary message
components/zendesk/actions/set-ticket-tags/set-ticket-tags.mjs (1)

1-47: LGTM: Well-implemented tag replacement action.

The action follows established patterns with:

  • Proper use of propDefinitions from the app
  • Clear documentation emphasizing the replacement behavior
  • Appropriate method call to the app's setTicketTags method
  • Informative summary message
components/zendesk/actions/update-ticket/update-ticket.mjs (5)

6-6: LGTM!

The description update accurately reflects the new tag management functionality.


8-8: LGTM!

Version increment is appropriate for the added functionality.


47-73: LGTM!

The new prop definitions are well-structured with clear descriptions and appropriate options for tag management.


146-147: LGTM!

The summary formatting follows the correct pattern and provides clear information about the operations performed.


113-143: Tag methods verified in Zendesk app module
All three methods—setTicketTags (line 317), addTicketTags (line 338), and removeTicketTags (line 359)—are implemented in components/zendesk/zendesk.app.mjs. No further action is required.

Comment on lines 135 to 137
if (!Object.keys(data).length) {
throw new Error("Please provide at least one field to update.");
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Adjust validation logic to handle internal note scenarios.

The current validation will fail if a user only provides internal note fields since they're excluded from the data object, even though the action can still perform the internal note operation.

-if (!Object.keys(data).length) {
+if (!Object.keys(data).length && !(internalNote && noteBody)) {
   throw new Error("Please provide at least one field to update.");
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (!Object.keys(data).length) {
throw new Error("Please provide at least one field to update.");
}
if (!Object.keys(data).length && !(internalNote && noteBody)) {
throw new Error("Please provide at least one field to update.");
}
🤖 Prompt for AI Agents
In components/freshdesk/actions/update-ticket/update-ticket.mjs around lines 135
to 137, the validation logic incorrectly throws an error when only internal note
fields are provided because these fields are excluded from the data object.
Modify the validation to also check if internal note fields are present and
allow the operation to proceed if either data fields or internal note fields
exist, ensuring internal note updates are not blocked.

Comment on lines +120 to +133
if (internalNote && noteBody) {
const response = await freshdesk._makeRequest({
$,
method: "POST",
url: `/tickets/${ticketId}/notes`,
data: {
body: noteBody,
private: true,
},
});

$.export("$summary", `Internal note added to ticket "${ticketName}" (ID: ${ticketId})`);
return response;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider supporting both internal note and ticket update in a single action call.

The current implementation creates an either/or scenario - users can either add an internal note OR update ticket fields, but not both. This limits the action's flexibility and may not align with user expectations.

Consider refactoring to support both operations:

 if (internalNote && noteBody) {
-  const response = await freshdesk._makeRequest({
+  const noteResponse = await freshdesk._makeRequest({
     $,
     method: "POST",
     url: `/tickets/${ticketId}/notes`,
     data: {
       body: noteBody,
       private: true,
     },
   });
-
-  $.export("$summary", `Internal note added to ticket "${ticketName}" (ID: ${ticketId})`);
-  return response;
 }

Then update the summary logic to reflect both operations when performed.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (internalNote && noteBody) {
const response = await freshdesk._makeRequest({
$,
method: "POST",
url: `/tickets/${ticketId}/notes`,
data: {
body: noteBody,
private: true,
},
});
$.export("$summary", `Internal note added to ticket "${ticketName}" (ID: ${ticketId})`);
return response;
}
if (internalNote && noteBody) {
const noteResponse = await freshdesk._makeRequest({
$,
method: "POST",
url: `/tickets/${ticketId}/notes`,
data: {
body: noteBody,
private: true,
},
});
}
🤖 Prompt for AI Agents
In components/freshdesk/actions/update-ticket/update-ticket.mjs around lines 120
to 133, the current code only supports adding an internal note or updating
ticket fields exclusively. Refactor the code to allow both adding an internal
note and updating ticket fields within the same action call by performing both
API requests if their respective data is present. Then, update the summary
export to reflect both operations when they occur together, ensuring the action
is more flexible and meets user expectations.

@seynadio
Copy link
Contributor Author

Closing this PR and replacing with #17609 which has only the Zendesk changes (no accidental Freshdesk changes) and represents a comprehensive ticket tag management implementation

@seynadio seynadio closed this Jul 14, 2025
@seynadio seynadio deleted the zendesk-ticket-tags branch July 14, 2025 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
User submitted Submitted by a user
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants